import java.io.File;
import java.io.IOException;
import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-09-09
 * Time: 12:52
 */
public class demo1 {
    public static void main1(String[] args) throws IOException {
        File file = new File("C:\\Vampire\\Directory1\\test.txt");
        System.out.println("File对象的父目录文件路径: " + file.getParent());
        System.out.println("File对象的文件名称: " + file.getName());
        System.out.println("File对象的文件路径: " + file.getPath());
        System.out.println("File对象的绝对路径: " + file.getAbsolutePath());
        System.out.println(file.getCanonicalPath());
        System.out.println("================");
    }

    public static void main(String[] args) {
        File file = new File(".");
//        System.out.println(Arrays.toString(file.list()));
        File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            System.out.print(files[i].getName() + " ");
        }
    }
}

